package com.bsit.obu.adapter;

import android.content.Context;

import com.bsit.obu.R;


import java.util.List;

/**
 * @author F.S.hao
 * @ClassName: OrderItemAdapter
 * @Description: TODO(订单列表)
 * @date 2015年12月15日 下午5:04:54
 */
public class NomalItemAdapter extends CommonAdapter<String> {
    Context mContext;
    int currentPosition;
    public NomalItemAdapter(Context context, List<String> data, int currentPosition) {
        super(context, data, R.layout.adapter_nomal_list_item);
        mContext = context;
        this.currentPosition = currentPosition;
    }

    public void refreshView(int index){
        currentPosition = index;
        notifyDataSetChanged();
    }

    @Override
    public void convert(ViewHolder holder, String info, int position) {
        if (info != null) {
            holder.setText(R.id.info_tv, info);
            if (currentPosition == -1){
                holder.setImageVisble(R.id.check_icon_iv,false);
            } else {
                if (position == currentPosition) {
                    holder.setImageResource(R.id.check_icon_iv, R.drawable.box_checked_icon);
                } else {
                    holder.setImageResource(R.id.check_icon_iv, R.drawable.box_uncheck_icon);
                }
            }
        }
    }
}
